from django import forms

class ContactForm(forms.Form):
    subject = forms.CharField(max_length=25)
    email = forms.EmailField(required = False,label="你的邮箱地址")
    message = forms.CharField(widget = forms.Textarea)
    
    def clean_message(self):
        message = self.cleaned_data['message']
        num_words = len(message)
        if num_words < 4:
            raise forms.ValidationError("not enought words!")
        return message